package com.tengju.support.domain.model.message;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;

@AllArgsConstructor
public enum SendStatus {

    NOT_SEND(1,"未发送"),
    SENDING(2,"正在发送"),
    SEND(3,"已发送"),
    ;

    private Integer val;
    private String desc;

    @JsonValue
    public Integer getVal() {
        return val;
    }

    public String getDesc() {
        return desc;
    }

    @JsonCreator
    public static SendStatus fromVal(Integer val) {
        for (SendStatus type : values()) {
            if (type.val.equals(val)) {
                return type;
            }
        }
        return null;
    }

}
